<template>
  <div class="app-container-custom">
    <el-table v-loading="loading" :data="copyroomList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="房间仪表" align="center" prop="rometerName"  width="180">
        <template slot-scope="scope">
          {{`${scope.row.roomName}[${scope.row.kindName}]`}}
        </template>
      </el-table-column>
      <el-table-column label="客户" align="center" prop="ownerName" />
      <el-table-column label="上次读数日期" align="center" prop="lastTime">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="上次读数" align="center" prop="lastReading" />
      <el-table-column label="读数日期" align="center" prop="readingTime">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.readingTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="本次读数" align="center" prop="theReading" />
      <el-table-column label="实际行读" align="center" prop="practicalLine" />
      <el-table-column label="调整行度" align="center" prop="adjustLine" />
      <el-table-column label="计费行度" align="center" prop="chargedLine" />
      <el-table-column label="抄表说明" align="center" prop="readerExplain"  show-overflow-tooltip/>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { listCopyroom } from "@/api/payfee/copyroom";

export default {
  name: "copyRoomList",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 抄房间仪表表格数据
      copyroomList: [],
      ownerRoomOptions:[],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        rometerId: null,
        readingTime: null,
        nodeId:null,
        roomIds:null
      },
      currentOptions:null
    };
  },
  created() {

  },
  methods: {
    show(options){
      this.currentOptions = options
      this.getList()
    },
    /** 查询抄房间仪表列表 */
    getList() {
      this.loading = true;
      this.queryParams.roomIds = this.currentOptions.roomIds
      listCopyroom(this.queryParams).then(response => {
        this.copyroomList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.copyId)
    }
  }
};
</script>
<style lang="scss" scoped>
  .form-class{
    .el-row{
      display:flex;
      flex-wrap: wrap;
    }
  }

</style>
